package com.example.day09_event;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;

public class My_View extends View {
    String TAG = "My_View";
    public My_View(Context context, AttributeSet attrs) {
        super(context, attrs);
    }
    /*
    处理事件的方法
    */
    @Override
    public boolean dispatchTouchEvent(MotionEvent event) {
        Log.d(TAG, "dispatchTouchEvent: "+event.getAction());
        //super.dispatchTouchEvent(event);事件分发
        return super.dispatchTouchEvent(event);
    }

    /*
    处理事件的方法
    */

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        Log.d(TAG, "onTouchEvent: "+event.getAction());
        return true;
    }
}
